import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/relation_query_entity.dart';

RelationQueryEntity $RelationQueryEntityFromJson(Map<String, dynamic> json) {
  final RelationQueryEntity relationQueryEntity = RelationQueryEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    relationQueryEntity.msg = msg;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    relationQueryEntity.code = code;
  }
  final List<RelationQueryData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<RelationQueryData>(e) as RelationQueryData)
      .toList();
  if (data != null) {
    relationQueryEntity.data = data;
  }
  return relationQueryEntity;
}

Map<String, dynamic> $RelationQueryEntityToJson(RelationQueryEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['code'] = entity.code;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension RelationQueryEntityExtension on RelationQueryEntity {
  RelationQueryEntity copyWith({
    String? msg,
    int? code,
    List<RelationQueryData>? data,
  }) {
    return RelationQueryEntity()
      ..msg = msg ?? this.msg
      ..code = code ?? this.code
      ..data = data ?? this.data;
  }
}

RelationQueryData $RelationQueryDataFromJson(Map<String, dynamic> json) {
  final RelationQueryData relationQueryData = RelationQueryData();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    relationQueryData.createTime = createTime;
  }
  final RelationQueryDataParams? params = jsonConvert.convert<
      RelationQueryDataParams>(json['params']);
  if (params != null) {
    relationQueryData.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    relationQueryData.id = id;
  }
  final String? relationName = jsonConvert.convert<String>(
      json['relationName']);
  if (relationName != null) {
    relationQueryData.relationName = relationName;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    relationQueryData.userId = userId;
  }
  return relationQueryData;
}

Map<String, dynamic> $RelationQueryDataToJson(RelationQueryData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['relationName'] = entity.relationName;
  data['userId'] = entity.userId;
  return data;
}

extension RelationQueryDataExtension on RelationQueryData {
  RelationQueryData copyWith({
    String? createTime,
    RelationQueryDataParams? params,
    int? id,
    String? relationName,
    int? userId,
  }) {
    return RelationQueryData()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..relationName = relationName ?? this.relationName
      ..userId = userId ?? this.userId;
  }
}

RelationQueryDataParams $RelationQueryDataParamsFromJson(
    Map<String, dynamic> json) {
  final RelationQueryDataParams relationQueryDataParams = RelationQueryDataParams();
  return relationQueryDataParams;
}

Map<String, dynamic> $RelationQueryDataParamsToJson(
    RelationQueryDataParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension RelationQueryDataParamsExtension on RelationQueryDataParams {
}